//
//  YYEMyCoursewareViewController.m
//  YuYingEDU
//
//  Created by 胡波 on 2018/1/10.
//  Copyright © 2018年 胡波. All rights reserved.
//

#import "YYEMyCoursewareViewController.h"
#import "YYETopicRecordTableViewCell.h"
#import "YYECoursewareDetailViewController.h"

@interface YYEMyCoursewareViewController () <UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) YYEBaseTableView *tableview;

@end

@implementation YYEMyCoursewareViewController

static NSString *coursewareCell = @"courseCell";
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = GeneralBackColor;
    
    [self configUI];
    
}

- (void)configUI {
    
    [self.view addSubview:self.tableview];
    self.tableview.backgroundColor = GeneralBackColor;
    self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.tableview registerClass:[YYETopicRecordTableViewCell class] forCellReuseIdentifier:coursewareCell];
    
    [self.tableview makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(UIEdgeInsetsZero);
    }];
    
}

- (YYEBaseTableView *)tableview {
    
    if (!_tableview) {
        _tableview = [[YYEBaseTableView alloc]initwithDelegate:self];
    }
    return _tableview;
    
}

#pragma mark -- UITableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 10;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    YYETopicRecordTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:coursewareCell];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return 81;
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    YYECoursewareDetailViewController *detailVC = [[YYECoursewareDetailViewController alloc]init];
    [self.navigationController pushViewController:detailVC animated:YES];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
